/*
 * Instruction.java
 * 
 * last update: 01.02.2010 by Florea Mihai
 * 
 * author:	Alec(panovici@elcom.pub.ro)
 * 			Florea Mihai(florea.mihai@gmail.com)
 * 
 * Obs:
 */

package engine;
import java.io.Serializable;
/**
 * The most general instruction. It provides a chaining
 * mechanism used by Time and ControlThread.
 */
@SuppressWarnings("serial")
public abstract class Instruction implements Serializable, Executable{


	/**
	 * the next instruction into this block
	 */
	Instruction next;


	public Instruction add(Instruction next){
		Instruction old = this.next;
		this.next = next;
		return old;
	}

	/**
	 * Default imlpementation; if and other branch instructions should
	 * provide an appropriate implementation.
	 */
	public Instruction next() {
		return next;
	}

	/**
	 * Adds i to the and of this instruction chain
	 */
	public void append (Instruction i) {
		if (next == null)
			next = i;
		else next.append(i);
	}

}
